package iammry.com.utils;
/**
 * 获取每个月的天数
 * @author kim
   @time 2016年3月31日下午5:02:33
   @des  TODO
   @version  1.0
 *
 */
public class CalculateDayofMonth {
	
	
	/**
	 * 获取每个月的天数
	 * @param year
	 * @param month
	 * @return
	 */
	public static int getDay(int year, int month) {
		int day = 30;
		boolean flag = false;
		switch (year % 4) {
		case 0:
			flag = true;
			break;
		default:
			flag = false;
			break;
		}
		switch (month) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			day = 31;
			break;
		case 2:
			day = flag ? 29 : 28;
			break;
		default:
			day = 30;
			break;
		}
		return day;
	}
	
}
